Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix standout mode #8708

Merged
merged 1 commit into from Jul 10, 2018
Merged

Fix standout mode #8708

merged 1 commit into from Jul 10, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jul 8, 2018

It was not working for me in different terminals.

This patch makes it work in the same way like reverse.

Test:

:hi jediUsage cterm=standout | hi jediUsage

I've used the following to see what is going on:

diff --git i/src/nvim/tui/tui.c w/src/nvim/tui/tui.c
index f1db9aed0..bf59b64c7 100644
--- i/src/nvim/tui/tui.c
+++ w/src/nvim/tui/tui.c
@@ -458,8 +458,12 @@ static void update_attrs(UI *ui, HlAttrs attrs)
   bool standout = attr & HL_STANDOUT;
   bool underline = attr & (HL_UNDERLINE), undercurl = attr & (HL_UNDERCURL);
 
+  ILOG("update_attrs: standout=%d", standout);
+
   if (unibi_get_str(data->ut, unibi_set_attributes)) {
+    ILOG("update_attrs: 1");
     if (bold || reverse || underline || undercurl || standout) {
+      ILOG("update_attrs: 2");
       UNIBI_SET_NUM_VAR(data->params[0], standout);
       UNIBI_SET_NUM_VAR(data->params[1], underline || undercurl);
       UNIBI_SET_NUM_VAR(data->params[2], reverse);
@@ -471,9 +475,11 @@ static void update_attrs(UI *ui, HlAttrs attrs)
       UNIBI_SET_NUM_VAR(data->params[8], 0);   // alternate character set
       unibi_out(ui, unibi_set_attributes);
     } else if (!data->default_attr) {
+      ILOG("update_attrs: 3");
       unibi_out(ui, unibi_exit_attribute_mode);
     }
   } else {
+    ILOG("update_attrs: 4");
     if (!data->default_attr) {
       unibi_out(ui, unibi_exit_attribute_mode);
     }
@@ -484,6 +490,7 @@ static void update_attrs(UI *ui, HlAttrs attrs)
       unibi_out(ui, unibi_enter_underline_mode);
     }
     if (standout) {
+      ILOG("update_attrs: 5");
       unibi_out(ui, unibi_enter_standout_mode);
     }
     if (reverse) {

It was not working for me in different terminals.

This patch makes it work in the same way like reverse.

Test:

    :hi jediUsage cterm=standout | hi jediUsage
@@ -459,8 +459,8 @@ static void update_attrs(UI *ui, HlAttrs attrs)
bool underline = attr & (HL_UNDERLINE), undercurl = attr & (HL_UNDERCURL);

if (unibi_get_str(data->ut, unibi_set_attributes)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this condition appears to be true always, which results in the else below not being reached (where standout is set).

@justinmk
Copy link
Member

justinmk commented Jul 8, 2018

It's not surprising that something was overlooked here. I mostly assumed that the change was working for whoever implemented it (and it seemed to work for me). But your changes make sense.

Why still WIP?

@blueyed
Copy link
Contributor Author

blueyed commented Jul 8, 2018

Why still WIP?

Because I have no clue - should be RFC only instead.

I wonder why/how it is working for you without this though?!

@blueyed blueyed changed the title [WIP/RFC] Fix standout mode [RFC] Fix standout mode Jul 8, 2018
@marvim marvim added the RFC label Jul 8, 2018
@bfredl
Copy link
Member

bfredl commented Jul 8, 2018

Seems to improve stuff for pangoterm /TERM=xterm.

@blueyed
Copy link
Contributor Author

blueyed commented Jul 10, 2018

I think this is good: reverse and standout are handled in the same way now, and actually reverse and standout are the same in infocmp for TERM=xterm and rxvt-unicode anyway: rev=\E[7m / smso=\E[7m.

@blueyed blueyed changed the title [RFC] Fix standout mode Fix standout mode Jul 10, 2018
@jamessan jamessan merged commit d241f27 into neovim:master Jul 10, 2018
@justinmk justinmk removed the RFC label Jul 10, 2018
@blueyed blueyed deleted the fix-standout branch July 10, 2018 18:54
justinmk added a commit that referenced this pull request Jul 18, 2018
FEATURES:
07499a8 #8709 man.vim: C highlighting for EXAMPLES section
07f82ad #8699 TUI: urxvt: also send xterm focus-reporting seqs
40911e4 #8616 API: emit nvim_buf_lines_event from :terminal
c46997a #8546 fillchars: Add "eob" flag

FIXES:
74d19f6 #8576 startup: avoid blank stdin buffer if other files were opened
4874214 #8737 Only waitpid() for processes that we care about
cd6e7e8 #8743 Check all child processes for exit in SIGCHLD handler
c230ef2 #8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff
0ed8b12 #8681 transstr_buf: fix length comparison
d241f27 #8708 TUI: Fix standout mode
9afed40 #8698 man.vim: fix for mandoc
e889640 #8682 provider/node: npm --loglevel silent
1cbc830 #8613 API: nvim_win_set_cursor: set curswant
bf6048e #8628 checkhealth: Python: fix VIRTUAL_ENV check
3cc3506 #8528 checkhealth: node.js: also search yarn

CHANGES:
b751449 #8619 defaults: shortmess+=F
1248178 #8578 highlight: high-priority CursorLine if fg is set.
01570f1 #8726 terminal: handle &confirm and :confirm on unloading
56065bb #8721 screen: truncate showmode messages
bf2460e #7551 buffer: fix copying :setlocal options
c1c14fa #8520 Ex mode: always "improved" (gQ)
050f397 #7992 options: remove 'maxcombine` option (always 6)

INTERNAL:
463da84 #7992 screen: use UTF-8 representation
coditva pushed a commit to coditva/neovim that referenced this pull request Jul 28, 2018
FEATURES:
07499a8 neovim#8709 man.vim: C highlighting for EXAMPLES section
07f82ad neovim#8699 TUI: urxvt: also send xterm focus-reporting seqs
40911e4 neovim#8616 API: emit nvim_buf_lines_event from :terminal
c46997a neovim#8546 fillchars: Add "eob" flag

FIXES:
74d19f6 neovim#8576 startup: avoid blank stdin buffer if other files were opened
4874214 neovim#8737 Only waitpid() for processes that we care about
cd6e7e8 neovim#8743 Check all child processes for exit in SIGCHLD handler
c230ef2 neovim#8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff
0ed8b12 neovim#8681 transstr_buf: fix length comparison
d241f27 neovim#8708 TUI: Fix standout mode
9afed40 neovim#8698 man.vim: fix for mandoc
e889640 neovim#8682 provider/node: npm --loglevel silent
1cbc830 neovim#8613 API: nvim_win_set_cursor: set curswant
bf6048e neovim#8628 checkhealth: Python: fix VIRTUAL_ENV check
3cc3506 neovim#8528 checkhealth: node.js: also search yarn

CHANGES:
b751449 neovim#8619 defaults: shortmess+=F
1248178 neovim#8578 highlight: high-priority CursorLine if fg is set.
01570f1 neovim#8726 terminal: handle &confirm and :confirm on unloading
56065bb neovim#8721 screen: truncate showmode messages
bf2460e neovim#7551 buffer: fix copying :setlocal options
c1c14fa neovim#8520 Ex mode: always "improved" (gQ)
050f397 neovim#7992 options: remove 'maxcombine` option (always 6)

INTERNAL:
463da84 neovim#7992 screen: use UTF-8 representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants